﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TestJar : MonoBehaviour
{

    public InputField width;
    public InputField height;
    public Text result;

    public void OnClickCalcButton()
    {
        float fh = float.Parse(height.text);
        float fw = float.Parse(width.text);
        fw = fw / 2;
        var angle = Mathf.Atan(fw / fh);
        angle = 180 * angle / Mathf.PI;
        Debug.Log("angle:" + angle);
        result.text = Mathf.FloorToInt(angle).ToString();
    }
    //void OnGUI()
    //{
    //    //方法一
    //    try
    //    {
    //        var javaClass = new AndroidJavaObject("com.kone.unitylib.MainActivity");
    //        string value1 = javaClass.Call<string>("TestJdQuery");
    //        GUI.Label(new Rect(10, 10, 500, 500), value1);
    //    }
    //    catch (System.Exception ex)
    //    {
    //        GUI.Label(new Rect(10, 10, 500, 500), ex.ToString());
    //    }
    //    //方法二
    //    //try
    //    //{
    //    //    AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    //    //    AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
    //    //    string value2 = jo.Call<string>("Test");
    //    //    GUI.Label(new Rect(20, 20, 500, 500), value2);
    //    //}
    //    //catch (System.Exception ex)
    //    //{
    //    //    GUI.Label(new Rect(20, 100, 500, 500), ex.ToString());
    //    //}

    //}
}